package com.automannn.springPractice.applicationContext.bean.create;

import com.automannn.springPractice.applicationContext.User;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * bean定义创建演示
 *
 * @author huangk
 * @date 2022/08/03
 */
public class BeanCreateDemo {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:bean-create-Application.xml");
        User userFactoryBean = context.getBean("userFactoryBean", User.class);
        User user = context.getBean("static-create-user", User.class);
        User bean = context.getBean("user-by-instance-method", User.class);
        System.out.println(user);
        System.out.println(bean);
        System.out.println(userFactoryBean);
        System.out.println(bean==user);
    }
}
